home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / help_jr / rand < prev    next >
Text File  |  1994-08-31  |  3KB  |  124 lines

  1. rand:
  2.  
  3. Syntax:    rand ( )
  4.     rand ( nrow , ncol )
  5.  
  6.     rand ( "type" )
  7.     rand ( "type" , d1 )
  8.     rand ( "type" , d1 , d2 )
  9.  
  10. Description:
  11.  
  12.     rand() creates a random scalar, or matrix.
  13.  
  14.     `rand()' produces a random scalar.
  15.  
  16.     `rand ( X , Y )' produces a randomly generated MATRIX with row
  17.     dimension X, and column dimension Y.
  18.  
  19.     `rand ( "type" , ... )' changes the distribution used when
  20.     generating random numbers. The value of type determines the
  21.     subsequent parameters.
  22.  
  23.     type:
  24.  
  25.     rand( "beta" , A , B )
  26.  
  27.     Sets the generator to return a random deviate from the
  28.     beta distribution  with parameters A and B.  The density of
  29.     the beta is 
  30.                x^(a-1) * (1-x)^(b-1) / B(a,b) for 0 < x < 1
  31.  
  32.     rand ( "chi" , DF )
  33.  
  34.     Sets the generator to return a random deviate from the
  35.     distribution of a chi-square with DF degrees of freedom random
  36.     variable.
  37.  
  38.     rand ( "exp" , AV )
  39.  
  40.     Sets the generator to return a random deviate from an
  41.     exponential distribution with mean AV.
  42.     
  43.     rand ( "f" , DFN  DFD )
  44.  
  45.     Sets the generator to return a random deviate from the F
  46.     (variance ratio) distribution with DFN degrees of freedom in
  47.     the numerator and DFD degrees of freedom in the denominator.
  48.  
  49.     rand ( "gamma" , A , R )
  50.  
  51.     Sets the generator to return a random deviate from the gamma
  52.     distribution whose density is:
  53.  
  54.         (A**R)/Gamma(R) * X**(R-1) * Exp(-A*X)
  55.  
  56.     rand ( "nchi" , DF , XNONC )
  57.  
  58.     Sets the generator to return a random deviate from the
  59.     distribution of a noncentral chi-square with DF degrees of
  60.     freedom and noncentrality parameter XNONC.
  61.  
  62.     rand ( "nf" , DFN , DFD, XNONC )
  63.  
  64.     Sets the generator to return a random deviate from the
  65.     noncentral F (variance ratio) distribution with DFN degrees of
  66.     freedom in the numerator, and DFD degrees of freedom in the
  67.     denominator, and noncentrality parameter XNONC.
  68.  
  69.     rand ( "normal" , AV , SD )
  70.  
  71.     Sets the generator to return a random deviate from a normal
  72.     distribution with mean, AV, and standard deviation, SD.
  73.  
  74.     rand ( "uniform" , LOW , HIGH )
  75.  
  76.     Sets the generator to return a uniform double between LOW and
  77.     HIGH
  78.  
  79.     rand ( "bin" , N , P )
  80.  
  81.     Returns a single random deviate from a binomial distribution
  82.     whose number of trials is N and whose probability of an event
  83.     in each trial is P. 
  84.  
  85.     rand ( "poisson" , AV )
  86.  
  87.     Sets the generator to return a random deviate from a
  88.     Poisson distribution with mean AV.
  89.  
  90.     rand ( "default" )
  91.  
  92.     Resets the random number generator to the default generator,
  93.     which generates a distributed random variable in the interval
  94.     0 -> 1. The interval endpoints are not returned.
  95.  
  96.     Examples:
  97.  
  98.     > rand()
  99.            0.368
  100.     > rand(4)
  101.      vector elements 1 thru 4
  102.            0.983       0.535       0.766       0.646
  103.     > rand(3,3)
  104.      matrix columns 1 thru 3
  105.            0.767       0.152       0.347
  106.             0.78       0.625       0.917
  107.            0.823       0.315        0.52
  108.  
  109.  
  110.     > rand("norm", 10.0, 2.0 );
  111.     > rand(10)
  112.      vector elements 1 thru 5
  113.             9.86        11.8        12.1        7.35        8.76
  114.      vector elements 6 thru 10
  115.             10.5        7.44        11.1        6.93        9.87
  116.  
  117.  
  118.     rand() uses the RANLIB library, authored by B. W. Brown and 
  119.     J. Lovato under grant CA-16672 from the National Cancer
  120.     Institute. 
  121.  
  122.  
  123. See Also: srand
  124.